﻿<UserControl x:Class="Test.Silverlight.ControlToolkit.Page"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:sctv="clr-namespace:Silverlight.ControlToolkit.Validator;assembly=Silverlight.ControlToolkit"
    xmlns:sctw="clr-namespace:Silverlight.ControlToolkit.Windows;assembly=Silverlight.ControlToolkit"
    xmlns:sctc="clr-namespace:Silverlight.ControlToolkit.Converters;assembly=Silverlight.ControlToolkit"
	xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"     
Width="600" Height="500" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <UserControl.Resources>
        <sctc:CurrencyConverter x:Key="MyCurrencyConverter" />
	    <Style x:Key="RoundCloseButton" TargetType="Button">
	        <Setter Property="Template">
	            <Setter.Value>
	                <ControlTemplate TargetType="Button">
	                    <Grid>
	                        <Grid.Resources>
	                            <!-- Hover -->
	                            <RadialGradientBrush x:Key="hoverBack" >
	                                <GradientStop Color="#FFE69B8F"/>
	                                <GradientStop Color="#FFCB6432" Offset="1"/>
	                                <GradientStop Color="#FFD26554" Offset="0.512"/>
	                            </RadialGradientBrush>
	                            <RadialGradientBrush x:Key="hoverBorder" >
	                                <GradientStop Color="Black"/>
	                            </RadialGradientBrush>

	                            <!-- Pressed -->
	                            <RadialGradientBrush x:Key="pressedBack" >
	                                <GradientStop Color="#FFAE907B"/>
	                                <GradientStop Color="#FF55390F" Offset="1"/>
	                                <GradientStop Color="#FF8A5840" Offset="0.512"/>
	                            </RadialGradientBrush>
	                            <RadialGradientBrush x:Key="pressedBorder" >
	                                <GradientStop Color="#FFFCFCFC"/>
	                                <GradientStop Color="#FFF1C27C" Offset="1"/>
	                                <GradientStop Color="#FFE8B6AD" Offset="0.512"/>
	                                <GradientStop Color="#FFD6978E" Offset="0.518"/>
	                            </RadialGradientBrush>

	                            <SolidColorBrush x:Key="CloseBorderBrush" Color="#FF542C24" />
	                            <RadialGradientBrush x:Key="CloseForeground">
	                                <GradientStop Color="#FFE3B5AF"/>
	                                <GradientStop Color="#FFC37F74" Offset="1"/>
	                                <GradientStop Color="#FFCF8279" Offset="0.512"/>
	                            </RadialGradientBrush>
	                            <RadialGradientBrush x:Key="CloseBackground">
	                                <GradientStop Color="#FFFCFCFC"/>
	                                <GradientStop Color="#FFE3B8B0" Offset="1"/>
	                                <GradientStop Color="#FFE0BFBD" Offset="0.512"/>
	                                <GradientStop Color="#FFD4A7A3" Offset="0.518"/>
	                            </RadialGradientBrush>
	                        </Grid.Resources>

	                        <vsm:VisualStateManager.VisualStateGroups>
	                            <vsm:VisualStateGroup x:Name="FocusStates">
	                                <vsm:VisualState x:Name="Unfocused"/>
	                                <vsm:VisualState x:Name="Focused"/>
	                            </vsm:VisualStateGroup>
	                            <vsm:VisualStateGroup x:Name="CommonStates">
	                                <vsm:VisualState x:Name="MouseOver">
	                                    <Storyboard>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="Background" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource hoverBack}" />
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="BorderBrush" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource hoverBorder}" />
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedRect" Storyboard.TargetProperty="Visibility" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0">
	                                                <DiscreteObjectKeyFrame.Value>
	                                                    <Visibility>Visible</Visibility>
	                                                </DiscreteObjectKeyFrame.Value>
	                                            </DiscreteObjectKeyFrame>
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="Visibility" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0">
	                                                <DiscreteObjectKeyFrame.Value>
	                                                    <Visibility>Visible</Visibility>
	                                                </DiscreteObjectKeyFrame.Value>
	                                            </DiscreteObjectKeyFrame>
	                                        </ObjectAnimationUsingKeyFrames>
	                                    </Storyboard>
	                                </vsm:VisualState>
	                                <vsm:VisualState x:Name="Pressed">
	                                    <Storyboard>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="Background" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource pressedBack}" />
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="BorderBrush" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource pressedBorder}" />
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedRect" Storyboard.TargetProperty="Visibility" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0">
	                                                <DiscreteObjectKeyFrame.Value>
	                                                    <Visibility>Visible</Visibility>
	                                                </DiscreteObjectKeyFrame.Value>
	                                            </DiscreteObjectKeyFrame>
	                                        </ObjectAnimationUsingKeyFrames>
	                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverPressedBorder" Storyboard.TargetProperty="Visibility" Duration="0">
	                                            <DiscreteObjectKeyFrame KeyTime="0">
	                                                <DiscreteObjectKeyFrame.Value>
	                                                    <Visibility>Visible</Visibility>
	                                                </DiscreteObjectKeyFrame.Value>
	                                            </DiscreteObjectKeyFrame>
	                                        </ObjectAnimationUsingKeyFrames>
	                                    </Storyboard>
	                                </vsm:VisualState>
	                                <vsm:VisualState x:Name="Disabled"/>
	                                <vsm:VisualState x:Name="Normal"/>
	                            </vsm:VisualStateGroup>
	                        </vsm:VisualStateManager.VisualStateGroups>
	                        <Border x:Name="Border" Margin="0" BorderThickness="1,1,1,1" Width="18" Height="18" CornerRadius="15,15,15,15"  BorderBrush="{StaticResource hoverBorder}" Background="{StaticResource hoverBack}"/>
	                        <Border x:Name="HoverPressedBorder" Margin="0" BorderThickness="1,1,1,1" Width="18" Height="18" CornerRadius="15" BorderBrush="{StaticResource CloseBorderBrush}"  Visibility="Collapsed" d:IsHidden="True"/>
	                        <Rectangle x:Name="HoverPressedRect" Height="18" Width="18" RadiusX="15" RadiusY="15" StrokeThickness="0"  Margin="0,1,0,2" Stroke="{StaticResource CloseBorderBrush}"  Visibility="Collapsed">
	                            <Rectangle.Fill>
	                                <RadialGradientBrush>
	                                    <RadialGradientBrush.RelativeTransform>
	                                        <TransformGroup>
	                                            <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="0.861" ScaleY="1.097"/>
	                                            <SkewTransform CenterX="0.5" CenterY="0.5"/>
	                                            <RotateTransform CenterX="0.5" CenterY="0.5"/>
	                                            <TranslateTransform Y="0.45"/>
	                                        </TransformGroup>
	                                    </RadialGradientBrush.RelativeTransform>
	                                    <GradientStop Color="#FFF5E777"/>
	                                    <GradientStop Color="#00FFFFFF" Offset="1"/>
	                                </RadialGradientBrush>
	                            </Rectangle.Fill>
	                        </Rectangle>

	                        <!--<ContentPresenter HorizontalAlignment="Center" Margin="1"/>-->
	                        <Path Height="10" HorizontalAlignment="Center" VerticalAlignment="Center" Width="12" Fill="#E4FFFFFF" Stretch="Fill" Stroke="#FF454651" Data="M0.5,0.5 L4.5178828,0.5 L6.0620003,3.125 L7.4936447,0.5 L11.5,0.5 L11.5,1.5476431 L8.7425003,6.1201854 L11.5,10.359666 L11.5,11.5 L7.4941902,11.5 L6.0620003,8.8740005 L4.5172949,11.5 L0.5,11.5 L0.5,10.43379 L3.3059995,6.1201582 L0.5,1.4676378 L0.5,0.5 z"/>

	                    </Grid>
	                </ControlTemplate>
	            </Setter.Value>
	        </Setter>
	    </Style>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel x:Name="myStackPanel" Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Button x:Name="btnStart"  Content="Test Me" Click="btnStart_Click" Height="200"/>
            <Button x:Name="btnStop" Content="Stop" Click="btnStop_Click" Height="50" />
                <sctw:WindowPanel Margin="10" IsExpandable="False" IsExpandedOnLoad="True" Width="200" HorizontalContentAlignment="Right" Background="Beige" HeaderBackground="Navy" BorderBrush="Green" HeaderForeground="Blue" HeaderText="New Window">
                    <TextBlock Text="My New Window Panel" />
                </sctw:WindowPanel>

            <TextBox x:Name="txtTest"  sctv:Validator.DataType="Custom" sctv:Validator.NegativeAllowed="True" sctv:Validator.IsRequired="True" />
        </StackPanel>
        <TextBlock  Text="My TEST 1" TextAlignment="Left" HorizontalAlignment="Left"  TextWrapping="NoWrap" Width="100" Height="50" />
        <Button HorizontalAlignment="Left" VerticalAlignment="Top" Content="Button"/>
    	<Button Height="62" HorizontalAlignment="Left" Margin="77,0,0,86" VerticalAlignment="Bottom" Width="186" Content="Button" Style="{StaticResource RoundCloseButton}"  />
    </Grid>
</UserControl>
